import { createRouter, createWebHashHistory } from 'vue-router'

// 导入组件
import Home from '../views/Home.vue'
import BlogDetail from '../views/BlogDetail.vue'
import Category from '../views/Category.vue'
import Tag from '../views/Tag.vue'
import AllArticles from '../views/AllArticles.vue'
import LatestArticles from '../views/LatestArticles.vue'
import About from '../views/About.vue'

// 定义路由
const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/blog/:id',
    name: 'BlogDetail',
    component: BlogDetail
  },
  {
    path: '/category/:id',
    name: 'Category',
    component: Category
  },
  {
    path: '/tag/:id',
    name: 'Tag',
    component: Tag
  },
  {
    path: '/all-articles',
    name: 'AllArticles',
    component: AllArticles
  },
  {
    path: '/latest-articles',
    name: 'LatestArticles',
    component: LatestArticles
  },
  {
    path: '/about',
    name: 'About',
    component: About
  }
]

// 创建路由实例
const router = createRouter({
  history: createWebHashHistory(),
  routes
})

// 导出路由实例
export default router